<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAccessRightsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('access_rights', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('主键id');
            $table->string('name',20)->unique()->comment('用户名称');
            $table->string('public_key',100)->unique()->comment('用户公钥');
            $table->string('private_key',100)->unique()->comment('用户私钥');
            $table->string('remark',225)->default('')->comment('备注');
            $table->unsignedInteger('business_id')->comment('所属业务');
            $table->tinyInteger('is_max_permissions')->default(-1)->comment('是否是大权限:1最大权限,-1非最大权限');
            $table->tinyInteger('status')->default(1)->comment('开关状态：1开启，-1关闭');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `access_rights` COMMENT='权限'");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('access_rights');
    }
}
